package twLogicQuizSubmission

import org.springframework.cloud.contract.spec.Contract

Contract.make {
    request {
        method("POST")
        url("/api/tw-logic-quiz-submission/answer")
        body("""
        {
            "userId":1,
            "assignmentId":1,
            "answers":[
                {
                    "quizItemId":1,
                    "answer":2
                }
            ]
        }
        """)
        bodyMatchers {
            jsonPath('$.userId', byRegex(number()))
            jsonPath('$.assignmentId', byRegex(number()))
            jsonPath('$.answers[*].quizItemId', byRegex(number()))
            jsonPath('$.answers[*].answer', byRegex(number()))
        }
        headers {
            header("id", 1)
            contentType(applicationJsonUtf8())
        }
    }
    response {
        status(201)
    }
}
